{% extends BASE_TEMPLATE %}
{% load i18n %}

{% block bodyclass %}security-tab{% endblock%}

{% block view_content %}


<h1>{% trans "Security scan" %}</h1>
  {% if security_scan %}
    <table>
      <tr>
        <td>{% trans "last scan date" %}</td>
        <td>{{ security_scan.last_scan_date|date:"o-m-d" }}</td>
      </tr>
      <tr>
        <td>{% trans "scan status" %}</td>
        <td>{{ security_scan.get_scan_status_display }}</td>
      </tr>
      <tr>
        <td>{% trans "next scan date" %}</td>
        <td>{{ security_scan.next_scan_date|date:"o-m-d" }}</td>
      </tr>
      <tr>
        <td>{% trans "details" %}</td>
        <td><a href='{{ security_scan.details_url }}'>{{ security_scan.details_url|default:"-"}}</a></td>
      </tr>
      <tr>
        <td>{% trans "request for a scan" %}</td>
        <td><a href='{{ security_scan.rescan_url }}'>{{ security_scan.rescan_url|default:"-"}}</a></td>
      </tr>
    </table>

    <h3>{% trans "Vulnerabilities" %}</h3>
    {% if security_scan.vulnerabilities.all %}
      <table>
        <tr>
          <th>{% trans "Name" %}</th>
          <th>{% trans "Risk" %}</th>
          <th>{% trans "Patch deadline" %}</th>
        </tr>
      {% for v in security_scan.vulnerabilities.all %}
        <tr>
          <td>{{ v.name }}</td>
          <td>{{ v.get_risk_display|default:"-" }}</td>
          <td
            {% if v.is_deadline_exceeded %}
              class='exceeded_deadline'
            {% endif %}
          >
            {{ v.patch_deadline|date:"o-m-d"|default:"-" }}
          </td>
        </tr>
      {% endfor %}
      </table>
    {% else %}
      <p>{% trans "No vulnerabilities found for this scan" %}</p>
    {% endif %}

  {% else %}
    <p>{% trans "No scan so far" %}</p>
  {% endif %}


{% endblock %}
